/*
 * Created on Dec 7, 2003
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package com.unash.util;

import junit.framework.TestCase;

/**
 * @author Unmesh Joshi
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class AsnUtilTest extends TestCase {

	/**
	 * Constructor for AsnUtilTest.
	 * @param arg0
	 */
	public AsnUtilTest(String arg0) {
		super(arg0);
	}

	public static void main(String[] args) {
		junit.swingui.TestRunner.run(AsnUtilTest.class);
	}

	final public void testGetLength() {
		
	}

	final public void testGetTag() {
		//AsnUtil.getTag();
	}


	final public void testReadNBytes() {
				
	}//testReadNBytes


	final public void testIsBitSet() {
		byte[] b1 = new byte[]{27,125};
	
		assertEquals(AsnUtil.isBitSet(b1[0],1),false);
		assertEquals(AsnUtil.isBitSet(b1[0],2),false);
		assertEquals(AsnUtil.isBitSet(b1[0],3),false);
		assertEquals(AsnUtil.isBitSet(b1[0],4),true);
		assertEquals(AsnUtil.isBitSet(b1[0],5),true);
		assertEquals(AsnUtil.isBitSet(b1[0],6),false);
		assertEquals(AsnUtil.isBitSet(b1[0],7),true);
		assertEquals(AsnUtil.isBitSet(b1[0],8),true);
		assertEquals(AsnUtil.isBitSet(b1[1],1),false);
		assertEquals(AsnUtil.isBitSet(b1[1],2),true);
		assertEquals(AsnUtil.isBitSet(b1[1],3),true);
		assertEquals(AsnUtil.isBitSet(b1[1],4),true);
		assertEquals(AsnUtil.isBitSet(b1[1],5),true);
		assertEquals(AsnUtil.isBitSet(b1[1],6),true);
		assertEquals(AsnUtil.isBitSet(b1[1],7),false);
		assertEquals(AsnUtil.isBitSet(b1[1],2),true);
	}//testIsBitSet
	
	
	final public void testByteArray(){
		byte[] b1 = new byte[]{0x55};
		byte[] b2 = new byte[]{55};
		byte[] b3 = new byte[]{55};
				
		ByteArray bA1 = new ByteArray(b1);
		ByteArray bA2 = new ByteArray(b2);
		ByteArray bA3 = new ByteArray(b3);
		
		assertEquals(bA1.equals(bA2),false);
		assertEquals(bA2.equals(bA3),true);
		assertEquals((bA1.hashCode() != bA2.hashCode()),true);
		assertEquals(bA2.hashCode(),bA3.hashCode());
		assertEquals(bA1.toInt(0),85);
		assertEquals(bA2.toInt(0),55);
		assertEquals(bA3.getByte(0),b3[0]);
		assertEquals(bA1.toString(),"01010101");
		assertEquals(bA2.toString(),"00110111");
		
	}//testByteArray

}//AsnUtilTest
